/*
 * =====================================================================================
 *
 *       Filename:  mystatc.c
 *
 *    Description:  mystat.c
 *
 *        Version:  1.0
 *        Created:  11/22/2017 09:06:25 AM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  YOUR NAME (lzm),
 *   Organization:
 *
 * =====================================================================================
 */

#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <unistd.h>

int main(int argc,char * argv[])
{
       struct stat file_stat;
    if(0 != stat(argv[argc-1], &file_stat)) //stat()通过文件名filename获取文件信息，并保存在buf所指的结构体stat中
    {
        perror("stat");
        exit(-1);
    }

       printf("   文件：'%s'\n",argv[argc-1]);
       printf("   大小：%d        块：%d         IO块：%d\n",file_stat.st_size,file_stat.st_blocks,file_stat.st_blksize);

}

